#ifndef _THEAD_SAFE_QUEUE_H_
#define _THEAD_SAFE_QUEUE_H_
#include <queue>
#include "thread_mutex.h"

template<typename _Type>
class ThreadSafeQueue
{
public:
	void push(const _Type &_value)
	{
		base_library::thread::recursive_mutex::scoped_lock lock(m_CS);
		m_stdqueue.push(_value);
	}
	void pop()
	{
		base_library::thread::recursive_mutex::scoped_lock lock(m_CS);
		m_stdqueue.pop();
	}
	size_t size()
	{
		base_library::thread::recursive_mutex::scoped_lock lock(m_CS);
		return m_stdqueue.size();
	}
	_Type &front()
	{		
		base_library::thread::recursive_mutex::scoped_lock lock(m_CS);
		return m_stdqueue.front();
	}
private:
	std::queue<_Type>			m_stdqueue;
	base_library::thread::recursive_mutex				
								m_CS;
};


#endif // _THEAD_SAFE_QUEUE_H_

